/**
 * 判断两个json 内的属性值是否全部相同相同
 * @param {Object} obj1
 * @param {Object} obj2
 * @returns {Boolean}
 */
function jsonObjEquals(obj1,obj2) {
    if (typeof obj1 === "object" && typeof obj2 === "object") {
        if (obj1 === null || obj2 === null) {
            return false;
        } else {
            if(JSON.stringify(obj1) === "{}") {
                if(JSON.stringify(obj2) === "{}") {
                    return true;
                }else {
                    return false;
                }
            }
            for(var i in obj1) {
               if(obj1[i] instanceof Array){
                   if(obj2[i] instanceof Array) {
                       if(!jsonObjEquals(obj1[i], obj2[2]))
                           return false;
                   }else {
                       return false;
                   }
               }else {
                   if(obj1[i] !== obj2[i])
                       return false;
               }
            }
           return true;
        }
    }
    return false;
}

// var obj1 = {"name":"user1", "old":1};
// var obj2 = {"old":2, "name":"user2"};
// var obj3 = {"name":"user1", "old":1};
// console.log(jsonObjEquals({}, obj3))
// console.log(jsonObjEquals(obj3, {}))

module.exports = jsonObjEquals